<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page isELIgnored="false" %>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>主题上传审核</title>
    <link rel="shortcut icon" href="/images/index/logo.ico">
    <style>
        .refresh {
            display: inline-block;
            float: right;
        }

        .form-group {
            margin-bottom: 35px;
        }
    </style>
</head>
<body>
<div class="refresh">
    <button class="btn btn-info search" title="刷新" data-url="/themeExamine/admin/list"><span
            class="glyphicon glyphicon-refresh"></span></button>
</div>
<div class="" style="margin-bottom: 65px;">
    <ol class="breadcrumb">
        <li><a href="javascript:;">主题案例管理</a></li>
        <li class="active">主题上传审核</li>
    </ol>
</div>
<div class="">
    <table class="table table-bordered table-responsive upload_check">
        <tr>
            <th>id</th>
            <th>上传者</th>
            <th>主题名称</th>
            <th>上传分类</th>
            <th>上传时间</th>
            <th>操作</th>
        </tr>
        <c:forEach var="data" items="${dataMap}">

            <tr>
                <td class="id">${data.id}</td>
                <td>${data.uname}</td>
                <td>${data.title}</td>
                <td>${data.cname}</td>
                <td>${data.date}</td>
                <td>
                    <a href="/themeExamine/admin/looktheme?tid=${data.id}" class=" btn btn-info" target="_blank">预览</a>
                    <button class=" btn btn-primary pass">通过</button>
                    <button class=" btn btn-danger no_pass" data-toggle="modal" data-target="#myModal">不通过</button>
                </td>
            </tr>
        </c:forEach>
    </table>

    <div class="modal fade" tabindex="-1" role="dialog" id="myModal">
        <div class="modal-dialog" role="document">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
                            aria-hidden="true">&times;</span></button>
                    <h4 class="modal-title">不通过理由</h4>
                </div>
                <div class="modal-body">
                    <div class="form-group">
                        <label>理由</label>
                        <textarea class="form-control content" placeholder="请填写你不通过的理由" rows="7"></textarea>
                    </div>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                    <button type="button" class="btn btn-primary on" data-dismiss="modal"> 提交</button>
                </div>
            </div>
        </div>
    </div>
</div>
<script>
    $(document).ready(function () {
        $('.search').click(function () {
            var scope = $(this);
            $('.content_right').load(scope.attr('data-url'));
            toast_text('刷新成功', 600);
        });
        //通过

        $('.pass').click(function () {
            custom_modal('你确定要通过？');
            var scope = $(this);
            $('.modal_footer button').eq(0).unbind().click(function () {
                $.post("/themeExamine/admin/passExamine", {
                    tid: scope.parent().siblings('.id').text(),
                    state: 2,
                    content: "null"
                }, function (data) {
                    if (data.code == 200) {
                        $('.modal_1').hide();
                        scope.parent().parent().remove();
                    }
                    toast_text(data.msg, 600);
                });
            });
        });

        //不通过
        $('.no_pass').click(function () {
            var id;
            id = $(this).parent().siblings('.id').text();
            var scope = $(this);
            $('.modal-footer button').eq(1).unbind().click(function () {
                var content = $("textarea").val();
                $.post("/themeExamine/admin/passExamine", {tid: id, state: -1, content: content}, function (data) {
                    if (data.code == 200) {
//                    $('.modal-backdrop').hide();
                        scope.parent().parent().remove();
                    }
                    toast_text(data.msg, 600)
                });
            });
        });

    });
</script>
</body>
</html>